package lanqiao;
/**
 * @Project : AlgorithmLearning
 * @Package : LanQiao.PrepareForCompetition
 * @File : Q1457.java
 * @Author : WangRuoyu
 * @Date : 2023/3/29 15:38
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Q1457 {
    static long N;

    static long C(long n, long m) {
        if (n < 0 || m < 0) {
            System.out.println("error");
            return 0;
        } else if (n == 0 || n == m) {
            return 1;
        } else {
            long res = 1;
            for (long i = 1, j = m; i <= n; ++i, --j) {
                res = res * j / i;
                if (res > N) {
                    return res;
                }
            }
            return res;
        }
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] words = br.readLine().split(" ");
        N = Long.parseLong(words[0]);
        if (N == 1) {
            System.out.println(1);
            return;
        }

        final int p = 16;

        for (int i = p; i > 0; --i) {
            long l = 2L * i;
            long r = Math.max(l, N);

            while (l < r) {
                long mid = (l + r) / 2;
                if (C(i, mid) >= N) {
                    r = mid;
                } else {
                    l = mid + 1;
                }
            }

            if (C(i, l) == N) {
                System.out.println((1 + l) * l / 2 + i + 1);
                return;
            }
        }
    }
}